package com.cdwm.mrp.controller.view;

import com.cdwm.mrp.domain.po.User;
import com.cdwm.mrp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @version v1.0
 * @Author: lyw
 * @Date: 2021/8/4
 */
@Controller
@RequestMapping("/user")
public class UserControllerView {

    @Autowired
    private UserService userServices;


    @GetMapping("/view/system/userView")
    public String userMainView(){
        return "view/system/user/user";
    }

    @GetMapping("/view/system/add")
    public String addUserView(){
        return "view/system/user/add";
    }

    @GetMapping("/view/system/edit/{id}")
    public String editUserView(@PathVariable Long id, Model model){
        User userEdit = userServices.getById(id);
        model.addAttribute("userEdit",userEdit);
        return "view/system/user/edit";
    }
}
